<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>About event persistence</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="event.flags.html">Event flags</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="event.callbacks.html">Event callbacks</a></div>
 <div class="up"><a href="book.event.html">Event</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="event.persistence" class="chapter">
 <h1>About event persistence</h1>

 <p class="para">
  By default, whenever a pending event becomes active (because its file
  descriptor is ready to read or write, or because its timeout expires), it
  becomes non-pending right before its callback is executed. Thus, to make the
  event pending again one may call
  <span class="methodname"><a href="event.add.html" class="methodname">Event::add()</a></span>
  on it again from inside the callback function.
 </p>
 <p class="para">
  If the
  <strong><code>Event::PERSIST</code></strong>
  flag is set on an event, however, the event is
  <em class="emphasis">persistent</em>
  . This means that event remains pending even when its callback is activated.
  <span class="methodname"><a href="event.del.html" class="methodname">Event::del()</a></span>
  method can be called to make it non-pending.
 </p>
 <p class="para">
  The timeout on a persistent event resets whenever the event&#039;s callback runs.
  Thus, if one has an event with flags
  <strong><code>Event::READ</code></strong>
  <em>|</em>
  <strong><code>Event::PERSIST</code></strong>
  and a timeout of five seconds, the event will become active:
 </p>
 <ol type="1">
  <li class="listitem">
   <p class="para">
    Whenever the socket or file descriptor is ready for reading.
   </p>
  </li>
  <li class="listitem">
   <p class="para">
    Whenever five seconds have passed since the event last became active.
   </p>
  </li>
 </ol>
 <p class="para">
  See also
  <a href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_about_event_persistence" class="link external">&raquo;&nbsp;Fast
 portable non-blocking network programming with Libevent, About Event
 Persistence</a>
 </p>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="event.flags.html">Event flags</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="event.callbacks.html">Event callbacks</a></div>
 <div class="up"><a href="book.event.html">Event</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
